﻿using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.SelfHost;

namespace WebApiDome
{
    class Program
    {
        static void Main(string[] args)
        {

            var config = new HttpSelfHostConfiguration(string.Format("http://localhost:12345"));
            config.MaxReceivedMessageSize = int.MaxValue;
            config.TransferMode = TransferMode.Buffered; 
            config.Routes.MapHttpRoute(
                "API Default", "{controller}/{action}/{id}",
                new {id = RouteParameter.Optional});
            using (HttpSelfHostServer server = new HttpSelfHostServer(config))
            {
                server.OpenAsync().Wait();
                Console.WriteLine("Press ESC to quit.");
                while (
                    !Console.ReadKey().Key.Equals(ConsoleKey.Escape))
                {
                }
            }
        }
    }
}
